﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="QuanLyBaiViet.ascx.cs" Inherits="Main.Controls.QuanLyBaiViet" %>

 <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
<div id="Location" class="Location" runat="server"><a href="../Administrator.aspx">Administrator Page</a> >> Quản lý Bài Viết</div>
<div id="Notice" class="Notice" runat="server" visible="false"></div>
<div id="Errors" class="Errors" runat="server" visible="false"></div>
<div id="Form">
       <div>
          <table style="width:100%" cellspacing="5">
            <tr>
            <td width="20%">
                <asp:DropDownList ID="ddlTheLoai" runat="server" Width="100%"></asp:DropDownList>
            </td>
            <td width="20%">
                <asp:DropDownList ID="ddlNgayThang" runat="server"  Width="100%"></asp:DropDownList>
            </td>
            <td width="25%">
                <asp:DropDownList ID="ddlThanhVien" runat="server"  Width="100%"></asp:DropDownList>
                <!-- Ở đây chỉ đổ thành viên có quyền viết bài vào -->
           </td>
           <td width="25%" >
                <asp:TextBox ID="txtTieuDe" runat="server" Width="100%">Tìm Kiếm Theo Tiêu Đề</asp:TextBox></td>
                <td width="*">&nbsp;&nbsp;&nbsp;<asp:LinkButton ID="lnkFilter" runat="server" OnClick="lnkFilter_Click" ><asp:Image ID="imgFind" runat="server" SkinID="Find"/></asp:LinkButton></td>
            </tr>
            </table>
        </div>
    <asp:GridView SkinID="GridViewSkin" DataKeyNames="MaBaiViet,NgayKhoiTao,TinhTrang,TieuDe,NoiDung" ID="GridView1" runat="server"
        AutoGenerateColumns="False" AllowPaging="True" AllowSorting="true"
        OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDeleting="GridView1_RowDeleting" OnRowDataBound="GridView1_RowDataBound" OnRowCommand="GridView1_RowCommand" OnSorting="GridView1_Sorting">
        <Columns>
             <asp:TemplateField ItemStyle-Width="4%">
                <HeaderTemplate>
                    <asp:CheckBox ID="chkAll" runat="server" />
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="chkBaiViet" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="8%" HeaderText="ID" SortExpression="MaBaiViet">
                <ItemTemplate>
                    <asp:Label id="lblMaBaiViet" runat="server" Text='<%# Eval ( "MaBaiViet" ) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="28%" HeaderText="Tiêu Đề" SortExpression="TieuDe">
                <ItemTemplate>
                    <asp:Label id="lblTieuDe" runat="server" ></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="18%" HeaderText="Thể Loại" SortExpression="TheLoai">
                <ItemTemplate>
                    <asp:Label id="lblTheLoai" runat="server" Text='<%# Eval ( "TheLoai.TenTheLoai" ) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="12%" HeaderText="Ngày Khởi Tạo" SortExpression="NgayKhoiTao">
                <ItemTemplate>
                    <asp:Label id="lblNgayKhoiTao"  runat="server"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="10%" HeaderText="Thành Viên" SortExpression="ThanhVien">
                <ItemTemplate>
                    <asp:Label id="lblThanhVien" runat="server" Text='<%# Eval ( "ThanhVien.TenThanhVien" ) %>' ></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Trạng Thái" >
                <ItemTemplate>
                <center>
                      <asp:LinkButton ID="lnkTinhTrang" CommandName="CapNhat_TinhTrang" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>' runat="server" ToolTip="Cập nhật Tình Trạng">
                          <asp:Image ID="imgTinhTrang" runat="server" ImageAlign="Middle" />
                    </asp:LinkButton>
                </center>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Bình Luận" >
                <ItemTemplate>
                    <center>
                        <asp:Label id="lblBinhLuan" runat="server"></asp:Label>
                    </center>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Thao T&#225;c" ControlStyle-Width="30%">
                <ItemTemplate>
                    <asp:HyperLink ID="lnkEdit" runat="server" ><asp:Image ID="imgEdit" runat="server" SkinID="Edit" /></asp:HyperLink>
                    <asp:LinkButton ID="lnkDelete" CommandName="Delete" runat="server" ToolTip="Xóa" OnClientClick="ShowConfirm(this,Message1); return false;">
                    <asp:Image ID="imgDelete" runat="server" SkinID="Delete" />
                    </asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <br />
    <label><b>Bulk Action</b>: </label>
    <asp:LinkButton runat="server" CssClass="Button2" id="lnkDeleteAll" Text="Xóa" OnClientClick="ShowConfirm(this,Message2); return false;" OnClick="lnkDeleteAll_Click"></asp:LinkButton>
     &nbsp;
     <asp:Image ID="imgSave" runat="server" SkinID="Save" Visible="false" />
     <asp:Image ID="imgCancel" runat="server" SkinID="Cancel" Visible="false" />
     <asp:Image ID="imgAsc" runat="server" SkinID="ASC" Visible="false" />
     <asp:Image ID="imgDesc" runat="server" SkinID="DESC" Visible="false" />
</div> <!--Form-->
</ContentTemplate>
</asp:UpdatePanel>
<script type="text/javascript">
SetUp();
var Message1 = "Bạn có chắc chắn muốn xóa bài viết này?<br/><br/>Việc Xóa Bài Viết sẽ dẫn đến các bình luận thuộc bài viết này cũng sẽ mất đi.";
var Message2 = "Bạn có chắc chắn muốn xóa các bài viết đang chọn không?";
</script>
 <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
           <ProgressTemplate>
                    <div class="overlay" id="divProgress" style="position: absolute">
                        <center>
                            <asp:Image runat="server" ID="AjaxLoading" SkinID="AjaxLoadingIndicator" />
                        </center>
                    </div>
            </ProgressTemplate>
        </asp:UpdateProgress>


